Source Code Viewer - Example 3 - FindCountryListByNameContainsAction

package name.matthewgreet.example3.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;

import name.matthewgreet.example3.action.ViewCountryListAction.CountryListByPartialNameFinder;
import name.matthewgreet.example3.common.AbstractFormDrivenActionSupport;
import name.matthewgreet.example3.common.BrowserTabSession;
import name.matthewgreet.example3.common.ListCache;
import name.matthewgreet.example3.form.FindCountryByNameContainsForm;
import name.matthewgreet.example3.vo.CountryDTO;

/**
 * Finds countries by first character of name.  
 */
@InterceptorRef("FormDrivenStack")
@Results({
	@Result(name=ActionSupport.INPUT, type="redirectAction", params = {"namespace", "/", "actionName", "ViewCountryList"}),
	@Result(name=ActionSupport.SUCCESS, type="redirectAction", params = {"namespace", "/", "actionName", "ViewCountryList"})
})
public class FindCountryListByNameContainsAction extends AbstractFormDrivenActionSupport<FindCountryByNameContainsForm> {
	private static final long serialVersionUID = -7979376337555804889L;
	
    @Action("/FindCountryListByNameContains")
    @Override
    public String execute() throws Exception {
    	BrowserTabSession session;
    	ListCache<Integer,CountryDTO> listCache;
    	
    	session = getBrowserTabSession();
    	listCache = ViewCountryListAction.retrieveListCache(session);
    	listCache.setListFinder(new CountryListByPartialNameFinder(session, getModel().getPartialName()));
		
		return SUCCESS;
    }

	@Override
	protected FindCountryByNameContainsForm makeForm() {
		return new FindCountryByNameContainsForm();
	}

}